<!--
 * @Description: 客户评价
 * @Author: wangwangwang
 * @Date: 2020-09-21 14:09:06
 * @LastEditors: Please set LastEditors
 * @LastEditTime: 2021-12-29 15:06:23
-->
<template>
  <div class="pages_content table">
    <el-container>
      <el-header>
        <breaDcrumb />
      </el-header>
      <el-main style="display: flex">
        <div>
          <div class="header_right" @click="showCardNav = !showCardNav">
            <div class="title">搜索</div>
            <div>
              <transition name="from"></transition>
              <span v-show="!showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-down"></i>
              </span>
              <transition name="to"></transition>
              <span v-show="showCardNav">
                <i style="margin-right: 5px" class="el-icon-arrow-up"></i>
              </span>
            </div>
          </div>
          <div v-show="showCardNav" class="hr"></div>
          <el-collapse-transition>
            <div v-show="showCardNav">
              <div class="search">
                <span style="display: inline-block;margin-bottom: 10px;">
                  <span style="margin-right: 12px">客户名称</span>
                  <el-input v-model="tableParam.roadwork" style="width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
                </span>
                <span style="margin-left: 24px">
                  <span style="margin-right: 12px">工程名称</span>
                  <el-input v-model="tableParam.enginnerrName" style="width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
                </span>
                <span style="margin-left: 24px">
                  <span style="margin-right: 12px">工程编号</span>
                  <el-input v-model="tableParam.enginnerrCode" style="width: 220px" clearable placeholder="请输入" @keyup.enter.native="gettableData()" />
                </span>
                <el-button icon="el-icon-search" size="medium" class="bottom_all" @click="(tableParam.page = 1), gettableData()">查 询</el-button>
                <el-button size="medium" class="bottom_all_two" style="margin-left: 12px" @click="init()">重 置</el-button>
              </div>
            </div>
          </el-collapse-transition>
          <div class="hr"></div>
          <div class="card" style="padding-top: 10px">
            <div v-loading="tableLoading" class="card_info" :style="style">
              <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="tableData" tooltip-effect="dark">
                <template v-for="(item, index2) in table">
                  <el-table-column v-if="item.status" :key="index2" :label="item.label" align="center" :width="item.width">
                    <template slot-scope="scope">
                      <span v-if="item.label == '序号'">{{
                        scope.$index + 1
                        }}</span>
                      <el-link v-else-if="item.label == '订单评价'" class="table_link" :underline="false" @click="open(scope.row, 'dialog1')">查看</el-link>
                      <el-link v-else-if="item.label == '工程评价'" class="table_link" :underline="false" @click="open(scope.row, 'dialog2')">查看</el-link>
                      <span v-else>{{ scope.row[item.prop] }}</span>
                    </template>
                  </el-table-column>
                </template>
              </el-table>
            </div>
          </div>
        </div>
      </el-main>
      <div class="card_bottom">
        <div class="card_bottom_left">
          <div class="top_page_totle">总共{{ total }}条</div>
          <el-pagination :current-page.sync="tableParam.page" :page-size="tableParam.pageSize" :page-sizes="[10, 20, 30, 40,50,100,200,500,1000]" layout="prev,pager,sizes,next,jumper" :total="total" @size-change="sizeChange" @current-change="gettableData()"></el-pagination>
        </div>
        <div>
          <el-button size="mini" icon="el-icon-refresh-right" class="bottom_all_two" @click="gettableData">刷新</el-button>
        </div>
      </div>
    </el-container>
    <!-- 订单评价 -->
    <el-dialog v-dialogDrag :visible.sync="dialog1" width="980px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">订单评价</span>
      <div>
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="arr1" tooltip-effect="dark">
          <el-table-column label="订单号" align="center" prop="orderNo"> </el-table-column>
          <el-table-column label="产品名称" align="center" prop="productName"> </el-table-column>
          <el-table-column label="供应速度" align="center" prop="supplySpeed"> </el-table-column>
          <el-table-column label="混凝土质量" align="center" prop="betonQuality"> </el-table-column>
          <el-table-column label="人员响应" align="center" prop="staffResponse"> </el-table-column>
          <el-table-column label="综合服务" align="center" prop="integratedService"> </el-table-column>
          <el-table-column label="泵送效率" align="center" prop="pumpEfficiency"> </el-table-column>
          <el-table-column label="前场安排" align="center" prop="frontCourtArrange"> </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="dialog1 = false,arr1=[]">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 工程评价 -->
    <el-dialog v-dialogDrag :visible.sync="dialog2" width="980px" :close-on-click-modal="false">
      <span slot="title" class="dialog-title">工程评价</span>
      <div>
        <el-table :header-cell-style="{ background: '#f3f6f9' }" :cell-style="{ borderRight: 'none' }" border stripe style="width: 100%" :data="arr1" tooltip-effect="dark">
          <el-table-column label="供应速度" align="center" prop="supplySpeed"> </el-table-column>
          <el-table-column label="混凝土质量" align="center" prop="betonQuality"> </el-table-column>
          <el-table-column label="人员响应" align="center" prop="staffResponse"> </el-table-column>
          <el-table-column label="综合服务" align="center" prop="integratedService"> </el-table-column>
          <el-table-column label="泵送效率" align="center" prop="pumpEfficiency"> </el-table-column>
          <el-table-column label="前场安排" align="center" prop="frontCourtArrange "> </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button class="bottom_all_two" @click="dialog2 = false,arr1=[]">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixins/ICPSmixin.js";
import { queryPage, queryList, queryOrderEvaluate } from "@/api/besSer/a.js";
export default {
  mixins: [mixin],
  data() {
    return {
      /*表格增删改查及下载接口*/
      queryPage: queryPage,
      /*表格数据*/
      table: [
        { label: "工程编号", width: "auto", prop: "enginnerrCode", status: true },
        { label: "工程名称", width: "auto", prop: "enginnerrName", status: true },
        { label: "客户名称", width: "auto", prop: "roadwork", status: true },
        {
          label: "联系人",
          width: "auto",
          prop: "roadworklInkman",
          status: true,
        },
        {
          label: "联系电话",
          width: "auto",
          prop: "roadworkPhone",
          status: true,
        },
        { label: "订单评价", width: "auto", prop: "", status: true },
        { label: "工程评价", width: "auto", prop: "", status: true },
      ],
      pagesType: 0,
      /*添加表单数据*/
      low: "",
      dialog1: false,
      dialog2: false,
      arr1: [],
    };
  },
  created() {
    /*存储拷贝的原初始化fromDate数据*/
    this.tableParam = {
      ...this.tableParam,
      enginnerrName: "",
      roadwork: ''
    };
    this.gettableData();
  },
  methods: {
    init() {
      /*重置数据*/
      this.tableParam.enginnerrCode = "";
      this.tableParam.enginnerrName = "";
      this.tableParam.roadwork = "";
      this.gettableData();
    },
    open(low, key) {
      this.low = low;
      this[key] = true;
      if (key == 'dialog1') {
        queryList({
          engineeringId: low.engineeringId, //订单ID
          category: 1
        }).then((res) => {
          this.arr1 = res.data;
          this.console(res.data);
        });
      }
      if (key == 'dialog2') {
        queryOrderEvaluate({
          engineeringId: low.engineeringId, //订单ID
          category: 2
        }).then((res) => {
          this.arr1 = res.data;
          this.console(res.data);
        });
      }
    },
    sizeChange(value) {
      this.tableParam.pageSize = value;
      this.gettableData();
    },
  },
};
</script>

<style lang="scss" scoped>
.el-input,
.el-select {
  width: 240px;
}
/*
 <el-link class="table_link" :underline="false">查看配合比</el-link>*/
.table_link {
  margin: 0 10px;
  color: $bg_color;
}

.table_link:hover {
  opacity: 0.8;
}
</style>
